from urllib.request import Request,build_opener
from fake_useragent import UserAgent
from urllib.request import ProxyHandler
url="http://httpbin.org/get"
headers = {
    "User-Agent": UserAgent().chrome
}
request = Request(url, headers=headers)
#代理
httpHander=ProxyHandler({"http":"218.249.45.162:52316"})
opener = build_opener(httpHander)
response=opener.open(request)
print(response.read().decode())